package cn.edu.zafu.bigdata.hjn;

// Rectangle 类，继承自 Shape
public class Rectangle extends Shape {
    // 长度和宽度属性
    private double length;
    private double width;

    // 构造函数
    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    // 实现面积计算方法
    @Override
    public double area() {
        return length * width;
    }

    // 实现周长计算方法
    @Override
    public double perimeter() {
        return 2 * (length + width);
    }
}

